home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / pparse.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-07  |  1.3 KB  |  49 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1989, Tera Computer Company
  5.  **/
  6.  
  7.   /* header for parsing predicates */
  8.  
  9. #ifndef pparse_h
  10. #define pparse_h
  11.  
  12. #include "attribute.h"
  13. #include "token.h"
  14.  
  15. typedef struct ptree PTREE;
  16.  
  17. typedef struct ptree         /* parse tree */
  18. {            
  19.     TOKEN token;        /* indicator of what it is */
  20.     char *val;            /* string for a value */
  21.     int lineno;            /* line number where this token appeared */
  22.     PTREE *left;        /* left child */
  23.     PTREE *right;        /* right child */
  24. };
  25.  
  26.   /* shorthand for otherwise tedious checks that must be done */
  27. #define ck \
  28.     if (error) return NULL;
  29.  
  30. #define ck_match(t) \
  31.     if (!match_token(t, TRUE, TRUE))    return NULL;
  32.  
  33.   /* some might call these first and follow sets... */
  34. #define command_list_ender(t) \
  35.     ((t) == ELSIF_TOKEN || (t) == ELSE_TOKEN || (t) == ENDIF_TOKEN || \
  36.      (t) == EOF_TOKEN)
  37.  
  38. #define node_starter(t) \
  39.     ((t) == STRING_TOKEN || (t) == IN_TOKEN || (t) == OUT_TOKEN || \
  40.      (t) == PARENTS_TOKEN || (t) == CHILDREN_TOKEN || (t) == SOURCE_TOKEN || \
  41.      (t) == SINK_TOKEN || (t) == ANCESTORS_TOKEN || (t) == DESCENDANTS_TOKEN)
  42.  
  43. #define attr_starter(t) \
  44.     ((t) == STRING_TOKEN || (t) == DISPLAYED_TOKEN || \
  45.      (t) == COALESCER_TOKEN || (t) == BRUSH_TOKEN || (t) == COLOR_TOKEN || \
  46.      (t) == SHAPE_TOKEN || (t) == NODE_TOKEN || (t) == EDGE_TOKEN)
  47.  
  48. #endif
  49.